package com.oxygen.design.singleton.bean;

/**
 * @author wangjie
 * @title: SingleObjectIdlerThreadSafety
 * @description: 懒汉式，线程安全
 * @date 2022/3/30 10:01
 **/
public class SingleObjectIdlerThreadSafety {

    private static SingleObjectIdlerThreadSafety instance;

    private SingleObjectIdlerThreadSafety() {
    }

    public static synchronized SingleObjectIdlerThreadSafety getInstance() {
        if (instance == null) {
            instance = new SingleObjectIdlerThreadSafety();
        }
        return instance;
    }

    public void showMessage() {
        System.out.println("Hello World!");
    }
}
